{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "你们，我们，他们\n",
      "你\n",
      "你们\n",
      "['你们，我们，他们', 'halo', '再见']\n",
      "你们，我们，他们\n",
      "ahu 123\n",
      "[1, 16]\n",
      "[1, 4, 9, 16, 25]\n",
      "[4, 9]\n",
      "[1, 4, 9, 16]\n",
      "[9, 16]\n",
      "[9, 16, 25]\n",
      "[1, 4, 9, 16, 25, 36, 49, 64, 81]\n",
      "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n"
     ]
    }
   ],
   "source": [
    "# -*- coding:utf-8 -*-\n",
    "\"\"\"\n",
    "日期：2021年10月7日\n",
    "\"\"\"\n",
    "# 字符串\n",
    "name = \"你们，我们，他们\"\n",
    "print(name)\n",
    "print(name[0])  # 你\n",
    "print(name[0:2])  # 你们\n",
    "\n",
    "lis = [\"你们，我们，他们\", \"halo\", \"再见\"]\n",
    "print(lis)\n",
    "# 取列表中的第一个值\n",
    "print(lis[0])\n",
    "\n",
    "user_list = [\"ahu\", \"peiqi\", \"ahua\"]\n",
    "password_list = [123, 456, 789]\n",
    "print(user_list[0], password_list[0])\n",
    "\n",
    "\n",
    "# star：若没有指定开始值，则默认是0，stop：若没有指定结束值，则取列表中的最大值，step：若没有指定步长值，则默认是1\n",
    "# : 右边的值取不到\n",
    "num = [1, 4, 9, 16, 25]\n",
    "\n",
    "print(num[:4:3])  # 每隔三个选择一个\n",
    "\n",
    "# 1.正向取值\n",
    "print(num[:])\n",
    "print(num[1:3])\n",
    "# 如果 : 左边的值是0，即从0开始取值，0可以省略不写\n",
    "print(num[0:4])  # print(num[:4])\n",
    "\n",
    "# 2.反向取值  ！！！要取最后一个值，直接省略不写即可,不能写0，左边的值比右边的值小\n",
    "print(num[-3:-1])\n",
    "print(num[-3:])\n",
    "\n",
    "# 列表之间的拼接\n",
    "num1 = [36, 49, 64, 81]\n",
    "print(num + num1)\n",
    "\n",
    "# 和range相似\n",
    "num2 = list(range(10))\n",
    "print(num2)\n",
    "\n",
    "# 构建列表 形式[] 其中元素以“，” 隔开\n",
    "# squares = [1,4,9,16,25]\n",
    "# print(squares)\n",
    "\n",
    "# 列表是有顺序的一组值，顺序是从0位置开始的\n",
    "# square = [1,4,9,16,25]\n",
    "# names_str = \"mike\",\"mary\",\"jan\",\n",
    "# print(name_str[0])\n",
    "# names = \"jiaxin,qiqi,jieting\"\n",
    "# print(name[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
